package com.ugrow.ugrowcommunity.activity.professional.fragment;

import android.content.DialogInterface;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.ugrow.ugrowcommunity.R;
import com.ugrow.ugrowcommunity.util.ToastUtil;


public class EngineeringFragment extends Fragment implements View.OnClickListener{


    private TextView javaselection,netselection,androidselection,iosselection,webselection,machineselection,Safetyselection,BigDataselection,automationselection;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_engineering, container, false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        javaselection = view.findViewById(R.id.javaselection);
        netselection = view.findViewById(R.id.netselection);
        androidselection = view.findViewById(R.id.androidselection);
        iosselection = view.findViewById(R.id.iosselection);
        webselection = view.findViewById(R.id.webselection);
        machineselection = view.findViewById(R.id.machineselection);
        Safetyselection = view.findViewById(R.id.Safetyselection);
        BigDataselection = view.findViewById(R.id.BigDataselection);
        automationselection = view.findViewById(R.id.automationselection);

        javaselection.setOnClickListener(this);
        netselection.setOnClickListener(this);
        androidselection.setOnClickListener(this);
        iosselection.setOnClickListener(this);
        webselection.setOnClickListener(this);
        machineselection.setOnClickListener(this);
        Safetyselection.setOnClickListener(this);
        BigDataselection.setOnClickListener(this);
        automationselection.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        showDialog();
    }

    private void showDialog(){
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage("专业选择后不可更改，确认选中吗？");
        builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {

            }
        });
        builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                ToastUtil.ToastShort(getActivity(),"成功");
                getActivity().finish();
            }
        });
        builder.create().show();
    }
}